package com.blog.blog.service.impl;

import com.blog.blog.dto.SaveCategoryDTO;
import com.blog.blog.mapper.CategoryMapper;
import com.blog.blog.service.CategoryService;
import org.springframework.stereotype.Service;

@Service
public class CategoryServiceImpl implements CategoryService {
    private final CategoryMapper categoryMapper;

    public CategoryServiceImpl(CategoryMapper categoryMapper) {
        this.categoryMapper = categoryMapper;
    }

    @Override
    public boolean create(SaveCategoryDTO dto) {
        return categoryMapper.insert(dto) > 0;
    }

    @Override
    public boolean update(Long id, SaveCategoryDTO dto) {
        return categoryMapper.update(id, dto) > 0;
    }

    @Override
    public boolean delete(Long id) {
        return categoryMapper.delete(id) > 0;
    }
}


